package com.gitee.ywj1352.order.service.impl;

import com.gitee.ywj1352.order.service.IOrderService;
import com.gitee.ywj1352.sharing.mapper.OrdersDao;
import com.gitee.ywj1352.sharing.po.Orders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Random;

@Service
public class OrderServiceImpl implements IOrderService {

    @Autowired
    OrdersDao ordersDao;
    @Override
    public void addOrder(Orders order,Long userId) {
        Random random = new Random(2324L);
        Orders orders = new Orders();
        orders.setUserId(userId);
        orders.setStatus(1);
        orders.setOrderId(userId+322334123L);
        orders.setShoppingId(19L+userId);
        orders.setSendTime(new Date());
        orders.setPostage(12);
        orders.setEndTime(new Date());
        orders.setPayment(new BigDecimal("123.12"));
        orders.setPaymentType(1);
        orders.setCreateTime(new Date());
        orders.setCloseTime(new Date());
        orders.setPaymentTime(new Date());
        ordersDao.insert(orders);
    }
}
